cmake_minimum_required(VERSION 2.6)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)

project(pingpong)

# find library
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})

if (64BIT)
add_definitions(-D__64BIT__)
endif()

if (WINDOWS)
add_definitions(-D__WINDOWS__)
add_definitions(-D_WIN32_WINNT=0x0501)
add_definitions(-W3)
else ()
add_definitions(-D__LINUX__)
add_definitions(-Wall)
	if (CMAKE_COMPILER_IS_GNUCXX)
	add_definitions(-std=gnu++0x)
	else ()
	add_definitions(-std=stdc++11)
	endif()
endif()

if (DEBUG)
add_definitions(-D__DEBUG__)
endif()

set(pingpong_SOURCES
    Summary.hpp
    Client.hpp
    Client.cc
    Worker.hpp
    Worker.cc
	Main.cc
)


include_directories(
	"${PROJECT_SOURCE_DIR}/../deps/nio"
)

add_executable(pingpong ${pingpong_SOURCES})
target_link_libraries(pingpong nio)
if (WINDOWS)
target_link_libraries(pingpong ws2_32)
else()
target_link_libraries(pingpong pthread boost_system boost_program_options rt)
endif()
